﻿CREATE TABLE [Raw].[PostData]
(
	[DataID] BIGINT IDENTITY(1,1) NOT NULL CONSTRAINT [RAW_PostData_DataID] PRIMARY KEY,
	[Domain] NVARCHAR(255) NULL, 
	[BannedBy] NVARCHAR(255) NULL, 
	[Subreddit] NVARCHAR(255) NULL, 
	[SelfTextHtml] NVARCHAR(500) NULL, 
	[SelfText] NVARCHAR(255) NULL, 
	[Likes] INT NOT NULL DEFAULT 0, 
	[SecureMedia] BIGINT NULL, 
	[Saved] BIT NOT NULL CONSTRAINT [RAW_PostData_Saved] DEFAULT ('False'), 
	[ID] NVARCHAR(255) NOT NULL CONSTRAINT [RAW_PostData_ID] UNIQUE, 
	[SecureMediaEmbed] BIGINT NULL, 
	[Clicked] BIT NOT NULL CONSTRAINT [RAW_PostData_Clicked] DEFAULT ('False'), 
	[Stickied] BIT NOT NULL CONSTRAINT [RAW_PostData_Stickied] DEFAULT ('False'), 
	[Author] NVARCHAR(255) NOT NULL CONSTRAINT [RAW_PostData_Author] DEFAULT ('UNKNOWN'), 
	[Score] INT NOT NULL CONSTRAINT [RAW_PostData_Score] DEFAULT (0), 
	[ApprovedBy] NVARCHAR(255) NULL, 
	[Over18] BIT NOT NULL CONSTRAINT [RAW_PostData_Over18] DEFAULT ('False'),
	[Hidden] BIT NOT NULL CONSTRAINT [RAW_PostData_Hidden] DEFAULT ('False'), 
	[Thumbnail] NVARCHAR(500) NULL, 
	[SubredditID] NVARCHAR(255) NOT NULL, 
	[Edited] BIT NOT NULL CONSTRAINT [RAW_PostData_Edited] DEFAULT ('False'), 
	[LinkFlairCssClass] NVARCHAR(500) NULL, 
	[AuthorFlairCssClass] NVARCHAR(500) NULL, 
	[Downs] INT NOT NULL CONSTRAINT [RAW_PostData_Downs] DEFAULT (0), 
	[IsSelf] BIT NOT NULL CONSTRAINT [RAW_PostData_IsSelf] DEFAULT ('False'), 
	[Permalink] NVARCHAR(1000) NOT NULL CONSTRAINT [RAW_PostData_Permalink] UNIQUE, 
	[Name] NVARCHAR(255) NOT NULL CONSTRAINT [RAW_PostData_Name] DEFAULT ('UNKNOWN'), 
	[Created] DATETIME NOT NULL CONSTRAINT [RAW_PostData_Created] DEFAULT (GETDATE()), 
	[URL] NVARCHAR(1000) NULL, 
	[AuthorFlairText] NVARCHAR(500) NULL, 
	[Title] NVARCHAR(1000) NOT NULL, 
	[CreatedUTC] DATETIME NOT NULL CONSTRAINT [RAW_PostData_CreatedUTC] DEFAULT (GETDATE()), 
	[LinkFlairText] NVARCHAR(500) NULL, 
	[Ups] INT NOT NULL CONSTRAINT [RAW_PostData_Ups] DEFAULT (0), 
	[NumComments] INT NOT NULL CONSTRAINT [RAW_PostData_NumComments] DEFAULT (0), 
	[NumReports] INT NOT NULL CONSTRAINT [RAW_PostData_NumReports] DEFAULT (0), 
	[Distinguished] BIT NOT NULL CONSTRAINT [RAW_PostData_Distinguished] DEFAULT ('False'),
	[MediaEmbed] BIGINT NULL CONSTRAINT [FK_PostData_TO_MediaEmbed_ON_MediaEmbedID] FOREIGN KEY ([MediaEmbed]) REFERENCES [Raw].[MediaEmbed]([MediaEmbedID]),
	[Media] BIGINT NULL CONSTRAINT [FK_PostData_TO_Media_ON_MediaID] FOREIGN KEY ([Media]) REFERENCES [Raw].[Media]([MediaID]),
	[CreatedBy] NVARCHAR(250) NOT NULL CONSTRAINT [RAW_PostData_CreatedBy] DEFAULT SYSTEM_USER,	
	[DateCreated] DATETIME NOT NULL CONSTRAINT [RAW_PostData_DateCreated] DEFAULT GETDATE(), 
	[DateDeleted] DATETIME NULL,
	[VersionUser] NVARCHAR(250) NOT NULL CONSTRAINT [RAW_PostData_VersionUser] DEFAULT SYSTEM_USER,
	[VersionDate] DATETIME NOT NULL CONSTRAINT [RAW_PostData_VersionDate] DEFAULT GETDATE()
)